<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox-content">
                <form class="form-horizontal m-t" id="signupForm">
                    <input id="redId" name="redId" type="hidden" th:value="${red.redId}">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">红包名称：</label>
                        <div class="col-sm-8">
                            <input id="redName" name="redName" class="form-control" type="text"
                                   th:value="${red.redName}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">设置领取类型:</label>
                        <div class="col-sm-8">
                            <label class="radio-inline">
                                <input type="radio" name="setType" value="1" th:field="*{red.setType}"/> 按充值金额的百分比
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="setType" value="0" th:field="*{red.setType}"/> 按上下限区间
                            </label>
                        </div>
                    </div>
                    <div id="s1" class="form-group">
                        <label class="col-sm-3 control-label">按充值金额的百分比：</label>
                        <div class="col-sm-8">
                            <input id="rate" name="rate" class="form-control"
                                   type="text" th:value="${red.rate}">
                        </div>
                    </div>
                    <div id="s2">
                    	<div class="form-group">
	                        <label class="col-sm-3 control-label">红包金额：</label>
	                        <div class="col-sm-8">
	                            <input id="amount" name="amount" class="form-control"
	                                   type="text" th:value="${red.amount}">
	                        </div>
	                    </div>
	                    <div class="form-group">
	                        <label class="col-sm-3 control-label">下限：</label>
	                        <div class="col-sm-8">
	                            <input id="lowerLimit" name="lowerLimit" class="form-control"
	                                   type="text" th:value="${red.lowerLimit}">
	                        </div>
	                    </div>
	                    <div class="form-group">
	                        <label class="col-sm-3 control-label">上限：</label>
	                        <div class="col-sm-8">
	                            <input id="upLimit" name="upLimit" class="form-control"
	                                   type="text" th:value="${red.upLimit}">
	                        </div>
	                    </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">说明：</label>
                        <div class="col-sm-8">
                            <input id="description" name="description" class="form-control"
                                   type="text" th:value="${red.redName}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">状态:</label>
                        <div class="col-sm-8">
                            <label class="radio-inline">
                                <input type="radio" name="state" value="1" th:field="*{red.state}"/> 正常
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="state" value="0" th:field="*{red.state}"/> 禁用
                            </label>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-8 col-sm-offset-3">
                            <button type="submit" class="btn btn-primary">提交</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" src="/js/appjs/partner/red/edit.js">
</script>
<script type="text/javascript">
$(function(){
	var val = $('input[name="setType"]:checked').val();
	if (val == '0') {
        $('#s2').show();
        $('#s1').hide();
    }
    else if (val == '1') {
        $('#s1').show();
        $('#s2').hide();
    }

	$('input[type=radio][name=setType]').change(function() {
        if (this.value == '0') {
            $('#s2').show();
            $('#s1').hide();
        }
        else if (this.value == '1') {
            $('#s1').show();
            $('#s2').hide();
        }
    });
 });
</script>
</body>
</html>
